Python Parallel Programming Cookbook by 2015
Author:2015
Language: eng
Format: epub, mobi
Publisher: Packt Publishing
In the main program, we execute the task that will be performed in a sequential mode:
if __name__ == "__main__": for item in number_list: evaluate_item(item)
Also, in a parallel mode, we will use the concurrent.futures module's pooling capability for a thread pool:
with concurrent.futures.ThreadPoolExecutor(max_workers=5)\ as executor: for item in number_list: executor.submit(evaluate_item, item)
The ThreadPoolExecutor executes the given task using one of its internally pooled threads. It manages five threads working on its pool. Each thread takes a job out from the pool and executes it. When the job is executed, it takes the next job to be processed from the thread pool.
When all the jobs are processed, the execution time is printed:
print ("Thread pool execution in " + \ str(time.clock() - start_time_1), "seconds")
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Deep Learning with Python by François Chollet(12587)
Hello! Python by Anthony Briggs(9924)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(9800)
The Mikado Method by Ola Ellnestam Daniel Brolund(9784)
Dependency Injection in .NET by Mark Seemann(9347)
A Developer's Guide to Building Resilient Cloud Applications with Azure by Hamida Rebai Trabelsi(9320)
Hit Refresh by Satya Nadella(8829)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8309)
Sass and Compass in Action by Wynn Netherland Nathan Weizenbaum Chris Eppstein Brandon Mathis(7787)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(7770)
Grails in Action by Glen Smith Peter Ledbrook(7704)
The Kubernetes Operator Framework Book by Michael Dame(7679)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7565)
Exploring Deepfakes by Bryan Lyon and Matt Tora(7475)
Practical Computer Architecture with Python and ARM by Alan Clements(7396)
Implementing Enterprise Observability for Success by Manisha Agrawal and Karun Krishnannair(7378)
Robo-Advisor with Python by Aki Ranin(7355)
Building Low Latency Applications with C++ by Sourav Ghosh(7258)
Svelte with Test-Driven Development by Daniel Irvine(7224)
